package com.huage_09.lesson_01;

public class AddableDemo {
    public static void main(String[] args) {
        //Lambda
//        useAdd(Integer::sum);
        useAdd((x,y)->x+y);
        //匿名内部类
        useAdd(new Addable() {
            @Override
            public int add(int x, int y) {
                int sum = x+y;
                return sum;
            }
        });
    }
    private static void useAdd(Addable a){
        int sum = a.add(7, 8);
        System.out.println(sum);
    }
}
